package BeenChina.PM.Service.Impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import BeenChina.PM.DAO.ErrorChildImageInfoDao; 
import BeenChina.PM.Model.ModelErrorChildImage; 
import BeenChina.PM.Service.QualityInfoService;

public class QualityInfoServiceImpl implements QualityInfoService{
 
	  private ErrorChildImageInfoDao errorChildImageInfoDao;  
	  
	    

		public ErrorChildImageInfoDao getErrorChildImageInfoDao() {
		return errorChildImageInfoDao;
	} 


	public void setErrorChildImageInfoDao(
			ErrorChildImageInfoDao errorChildImageInfoDao) {
		this.errorChildImageInfoDao = errorChildImageInfoDao;
	}

 

		@Override
		public List<ModelErrorChildImage> selectErrorChildImage(
				String dateFrom, String dateTo) {
			try{			 
				Map<String, String> params = new HashMap<String, String>();
				 
				params.put("dateFrom", dateFrom);
				params.put("dateTo", dateTo); 

				return errorChildImageInfoDao.selectErrorChildImage(params);
			 } catch (Exception e) {  
	             e.printStackTrace();  
	             return null;
	         }  
		}
		
		public List<ModelErrorChildImage> selectErrorChildImageQuery(
				String dateFrom, String dateTo) {
			try{			 
				Map<String, String> params = new HashMap<String, String>();
				 
				params.put("dateFrom", dateFrom);
				params.put("dateTo", dateTo); 

				return errorChildImageInfoDao.selectErrorChildImageQuery(params);
			 } catch (Exception e) {  
	             e.printStackTrace();  
	             return null;
	         }  
		}


		@Override
		public Integer updateFinalResult(String id,
				String finalResult,
				String correctEntryResult,
				String correctCommentID,
				String audit) {
			try{			 

				ModelErrorChildImage image = new ModelErrorChildImage();
				image.setId(id);
				image.setFinalResult(finalResult);
				image.setCorrectEntryResult(correctEntryResult);
				image.setCorrectCommentID(correctCommentID);
				image.setAudit(audit);

				return errorChildImageInfoDao.updateFinalResult(image);
			 } catch (Exception e) {  
	             e.printStackTrace();  
	             return -1;
	         }  
		} 
	    
	   
}
